[#import "/framework/JGP.htm"  as JGP]
<!--
项目   Bsm
作者   fdp
时间   2018/7/23
-->
[@JGP.head "Title"/]
[@JGP.body]
<jgp-div class="big_box" _row="['0','*']" _aux="true">


    <jgp-div slot="2-1" _row="['8','*']" _aux="true">
        <jgp-div slot="1-1" _col="['*','*','*']" _aux="false" >
            <jgp-query slot="1-1"  _target="grid" _id="query" _auto="false" _page_size="12">
                <jgp-text   _col="8" _placeholder="搜索会议相关名称" _name="name" ></jgp-text>
                <jgp-btn  _fn="search" _margin="5" _icon="search">搜索</jgp-btn>
            </jgp-query>
            <jgp-btn slot="1-2" _margin="5" _fn="addMeeting">新建会议</jgp-btn>
        </jgp-div>

        <jgp-grid  _id="grid" slot="2-1"  _record_tools="[{'icon':'edit','tip':'编辑','fn':'editMeeting'},{'icon':'arrow-up','tip':'上传附件','fn':'addUpload'},{'icon':'user-circle','tip':'参会人员列表','fn':'listJoinMeetUsers'},{'icon':'user-circle','tip':'设置会议总管','fn':'addConfManage'},{'icon':'users','tip':'座次安排','fn':'showSeating'},{'icon':'times-rectangle','tip':'删除','fn':'removeMeeting'}]"
                   _index="true"></jgp-grid>
    </jgp-div>
</jgp-div>


[/@JGP.body]

[@JGP.foot]
<script>
    //页面渲染完成之后调用,列表初始化
    JGP.$onload(search())
    //手动搜索
    function search() {
        JGP.query('query').searchTo('/glMeeting/meetingApiController/queryMeetings',function () {

        },function () {

        });
    }
    //点击新建会议弹出框
    function addMeeting(re){
        var config = {
            url:'/glMeeting/meetingController/addMeeting',
            title:"新建会议",
            callback:function(res){
                if(res==true){
                    window.location.reload();
                }
            },
            width:'700px',
            height:'500px'
        }
        JGP.$dialog(config)
    }

    //设置会议总管
    function addConfManage(re){
        var config = {
            url:'/glMeeting/meetingManagerRelationController/addConfManager/'+re.back.id,
            title:"设置会议总管",
            callback:function(res){
                // console.log(res)
                if(res==true){
                    window.location.reload();
                }
            },
            width:'300px',
            height:'200px'
        }
        JGP.$dialog(config)
    }

    //参会人员列表
    function listJoinMeetUsers(re){
        var config = {
            url:'/glMeeting/meetingParticipantsRelationController/listJoinMeetUsers/'+re.back.id,
            title:"参会人员列表",
            callback:function(res){
                // console.log(res)
                if(res==true){
                    window.location.reload();
                }
            },
            width:'800px',
            height:'600px'
        }
        JGP.$dialog(config)
    }
    //点击编辑修改
    function editMeeting(re){

        var config = {
            url:'/glMeeting/meetingController/editMeeting/'+re.back.id,
            title:"修改会议信息",
            callback:function(res){
               // console.log(res)
                if(res==true){
                    window.location.reload();
                }
            },
            width:'700px',
            height:'600px'
        }
        JGP.$dialog(config)
    }

    //点击上传附件
    function addUpload(re){
        /*var config = {
            url:'/glMeeting/meetingController/addUpload/'+re.back.id,
            title:"上传文件",
            callback:function(res){
                if(res==true){
                    window.location.reload();
                }
            },
            width:'700px',
            height:'600px'
        }
        JGP.$dialog(config)*/

        var config = {
            objectId:re.back.id,
            objectType:'com.jgp.glmeeting.model.Meeting',
            callback: function (reuslt) {
               // JGP.$updateMountInfo(objId, objType, fileIds)
            }
        }
        JGP.$upload(config);
    }

    //删除会议（谨慎啊）
    function removeMeeting(re) {
        JGP.$confirm("是否确认删除",function () {
            JGP.$post('/glMeeting/meetingApiController/removeMeeting',{id:re.back.id},function (res) {
                JGP.$alert("删除成功")
                if (res.flag==true) {
                    window.location.reload();
                }
            })
        })
    }

    // //点击查看所有附件   {'icon':'sticky-note-o','tip':'正文','fn':'lookfiles'}
    // function lookfiles(re){
    //     var config = {
    //         url:'/webBsm/pages/lookfiles/'+re.back.id,
    //         title:"本次会议所有附件",
    //         callback:function(res){
    //             if(res==true){
    //                 window.location.reload();
    //             }
    //         },
    //         width:'700px',
    //         height:'600px'
    //     }
    //     JGP.$dialog(config)
    // }
    //安排座次
    function showSeating(re) {
        var config = {
            url:'/glMeeting/meetingController/showSeating/'+re.back.id,
            title:"添加座次",
            callback:function(res){
                // console.log(res)
                if(res==true){
                    window.location.reload();
                }
            },
            width:'1000px',
            height:'600px'
        }
        JGP.$dialog(config)
    }


</script>
[/@JGP.foot]